<?php
echo $this->Form->create('Resources', array('action' => 'show', 'inputDefaults' =>array('label'=>false)));
?>
<br>
<div class="input-group">
    <?php echo $this->Form->input('search',array('type'=>'text','class'=>'form-control'));?>
    <span class="input-group-btn">
        <?php echo $this->Form->button('Search',array('type'=>'submit','class'=>'btn btn-default'));?>
    </span>
</div>


 <?php echo $this->Form->end(); ?>
<br>

<?php
// set url arguements
$this->Paginator->options(array('url' => array($filter)));

// set up  alphabet
$alpha = range('A', 'Z');

if ($filter == 'all') {
    // if the current letter matches the filter, give it a selected style
    echo $this->Html->link('All', array('controller' => strtolower($this->params['controller']), 'action' => 'show', 'all'), array('class' => 'link_selected')) . " | ";
} else {
    echo $this->Html->link('All', array('controller' => strtolower($this->params['controller']), 'action' => 'show', 'all'), array('class' => 'link')) . " | ";
}

for ($i = 0; $i < count($alpha); $i++) {
    // if current letter is not in the links array, do not make it clickable
    if (!in_array($alpha[$i], $links)) {
        echo"<span class='nolink'>" . $alpha[$i] . "</span> | ";
    } else {
        if ($alpha[$i] == $filter) {
            // if the current letter matches the filter, give it a selected style
            echo $this->Html->link($alpha[$i], array('controller' => strtolower($this->params['controller']), 'action' => 'show', $alpha[$i]), array('class' => 'link_selected')) . " | ";
        } else {
            echo $this->Html->link($alpha[$i], array('controller' => strtolower($this->params['controller']), 'action' => 'show', $alpha[$i]), array('class' => 'link')) . " | ";
        }
    }
}

echo "<br>";

foreach ($data as $row) {
    echo "<br>" . $row['Resource']['res_name'] . " [ " . $this->Html->link('detail', array('controller' => strtolower($this->params['controller']), 'action' => 'view', $row['Resource']['res_id'])) . " ]";
}
?>